package jedis;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPubSub;

public class SubTest {

	public static void main(String[] args) {
		final Jedis jedisP = new Jedis("192.168.128.128", 6379);

		new Thread(new Runnable() {

			@Override
			public void run() {
				jedisP.subscribe(new ListenerTest(), "aa", "bb");

			}
		}).start();
	}

}

class ListenerTest extends JedisPubSub {

	@Override
	public void onMessage(String arg0, String arg1) {
		System.out.println(arg0);
		System.out.println(arg1);
	}

	@Override
	public void onPMessage(String arg0, String arg1, String arg2) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onPSubscribe(String arg0, int arg1) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onPUnsubscribe(String arg0, int arg1) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onSubscribe(String arg0, int arg1) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onUnsubscribe(String arg0, int arg1) {
		// TODO Auto-generated method stub

	}
}